<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Object-oriented JavaScript example</title>
  </head>

  <body>
    <p>This example requires you to enter commands in your browser's JavaScript console (see <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools">What are browser developer tools</a> for more information).</p>

  </body>

    <script>
	const user = {
	  name: ['John'],
	  surname :['Mike']
	};
	
	var fruit = {
		apple: 20,
		pear: 20,
		peach: 10
		};
		
		//计算对象中某个属性合计
	function countTotal(fruit) {
		let $total = 0;
		$total = fruit['apple']+fruit['pear']+fruit['peach']
		return $total;
}


    </script>
</html>